package thread_pool;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created with IDEA
 * author:ju bai
 * Date:2021/5/23
 * Time:11:46
 **/
public class PoolDemo21 {
    //实现10个Date（时间类型）的格式化
    public static void main(String[] args) {
        for (int i = 1; i < 11; i++) {
            final int finalI = i;


            Thread t1 = new Thread(new Runnable() {
                @Override
                public void run() {
                    Date date = new Date(finalI*1000);
                    myFormatTime(date);
                }
            });
            t1.start();
        }
    }

    /**
     * 自定义格式化时间
     * @param date 时间
     */
    private static void myFormatTime(Date date) {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("mm:ss");
        String result = simpleDateFormat.format(date);
        System.out.println("时间"+result);
    }
}
